package linearsearch;

import java.util.Objects;

public class Student {
    private String name;
    private Integer age;

    public Student() {
    }

    public Student(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || o.getClass() != getClass()) return false;
        Student anotherStudent = (Student) o;
        return Objects.equals(anotherStudent.getName(), this.getName()) && Objects.equals(anotherStudent.getAge(), this.getAge());
    }

    @Override
    public int hashCode() {
        int B = 31;
        int hash = 0;
        hash = hash * B + this.getAge();
        hash = hash * B + this.getName().hashCode();
        return hash;
    }
}
